//题目编辑。
Ext.define("ES.view.items.ItemsEdit",{
    extend:"Ext.window.Window",
    alias:"widget.itemsEdit",
    title:"题目",
    width:620,
    height:470,
    layout:"fit",
    modal:true,
    items:{
        xtype:"form",
        defaultType:"textfield",
        frame:true,
        layout:"column",
        buttonAlign:"center",
        items:[{
            xtype:"fieldset",
            title:"题目信息",
            columnWidth:1,
            defaultType:"textfield",
            defaults:{
                abelSeparator:":",
                labelWidth:52,
                labelAlign:"right",
                allowBlank:true,
                blankText:"不允许为空",
                msgTarget:"side",
                columnWidth:1
            },
            layout:"column",
            items:[{
                xtype:"combo",
                fieldLabel:"所属科目",
                emptyText:"====所属科目====",
                name:"catalogID",  
                store:"CatalogStore",
                displayField:"fullCatalogName",
                valueField:"catalogID",
                queryMode:"local",
                allowBlank:false
            },{
                xtype:"combo",
                fieldLabel:"所属章节",
                emptyText:"====所属章节====",
                name:"sectionID", 
                store:"SectionsToBindStore",
                displayField:"fullSectionName",
                valueField:"sectionID",
                queryMode:"local",
                columnWidth:0.5
            },{
                xtype:"combo",
                fieldLabel:"题型",
                labelWidth:32,
                emptyText:"====所属题型====",
                name:"typeID",
                typeAhead:true,
                store:"QuestionsToBindStore",
                displayField:"questionName",
                valueField:"questionID",
                queryMode:"local",
                columnWidth:0.3
//                listeners:{
//                    beforerender:function(combo){
//                        var st = combo.store;
//                        if(st){
//                            st.load();
//                        }
//                    },
//                    afterRender:function(cmp){
//                        var st = cmp.store;
//                        if(st){
//                            var record = st.getAt(0);
//                            if(record){
//                                cmp.setValue(record);
//                                cmp.fireEvent("select",cmp, [record]);
//                            }
//                        }
//                    }
//                }
            },{
                xtype:"numberfield",
                fieldLabel:"难度值",
                labelWidth:42,
                name:"difficulty",
                maxValue:99,
                minValue:0,
                value:0,
                columnWidth:0.2,
                allowBlank:false
            },{
                xtype:"textareafield",
                name:"content",
                fieldLabel:"题目",
                labelWidth:28,
                grow:true,
                columnWidth:1
            }]
        }],
        buttons:[{
            text:"保存",
            action:"btnSave",
            formBind:true,
            disabled:true,
            tooltip:"保存数据"
        },{
            text:"取消",
            action:"btnCancel",
            tooltip:"关闭窗口"
        }]
    },
    initComponent:function(){
        this.callParent(arguments);
    }
})